VERSION 5.00
Begin VB.Form frmMainMenu 
   BackColor       =   &H0080C0FF&
   BorderStyle     =   0  'None
   Caption         =   "Main Menu"
   ClientHeight    =   6750
   ClientLeft      =   150
   ClientTop       =   -30
   ClientWidth     =   5250
   ControlBox      =   0   'False
   Icon            =   "frmMainMenu.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6750
   ScaleMode       =   0  'User
   ScaleWidth      =   5250
   StartUpPosition =   2  'CenterScreen
   Begin VB.Timer Status 
      Interval        =   2000
      Left            =   1320
      Top             =   360
   End
   Begin VB.Label lblss 
      BackStyle       =   0  'Transparent
      Caption         =   "Online"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   6.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004080&
      Height          =   255
      Left            =   1680
      TabIndex        =   6
      Top             =   6000
      Width           =   2055
   End
   Begin VB.Label picQuit 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   232
      Left            =   4680
      TabIndex        =   5
      ToolTipText     =   "Exit"
      Top             =   284
      Width           =   246
   End
   Begin VB.Label lblStat2 
      BackStyle       =   0  'Transparent
      Caption         =   "Server Status:"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   6.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   720
      TabIndex        =   4
      Top             =   6000
      Width           =   975
   End
   Begin VB.Label picLogin 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "Login"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2025
      TabIndex        =   3
      Top             =   2325
      Width           =   1125
   End
   Begin VB.Label picNewAccount 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "New"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2010
      TabIndex        =   2
      Top             =   2925
      Width           =   1125
   End
   Begin VB.Label picDeleteAccount 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "Delete"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   210
      Left            =   2025
      TabIndex        =   1
      Top             =   3525
      Width           =   1125
   End
   Begin VB.Label picCredits 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "Credits"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   2025
      TabIndex        =   0
      Top             =   4125
      Width           =   1125
   End
End
Attribute VB_Name = "frmMainMenu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'    Copyright 2010 ScriptWisdom
'    This file is part of the Greentail Engine.
'
'    Greentail Engine is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.
'
'    Greentail Engine is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'    You should have received a copy of the GNU General Public License
'    along with Greentail Engine.  If not, see <http://www.gnu.org/licenses/>.

Option Explicit

'API Delcares
Private Declare Function ExtCreateRegion Lib "gdi32" (lpXform As Any, ByVal nCount As Long, lpRgnData As Any) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
               ByVal hwnd As Long, _
               ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
               ByVal hwnd As Long, _
               ByVal nIndex As Long, _
               ByVal dwNewLong As Long) As Long
               
Private Declare Function SetLayeredWindowAttributes Lib "user32" ( _
               ByVal hwnd As Long, _
               ByVal crKey As Long, _
               ByVal bAlpha As Byte, _
               ByVal dwFlags As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2

Dim bytRegion(1311) As Byte
Dim nBytes As Long

Private Sub Form_Load()
Dim OK As Long
Dim OK2 As Long
Dim AppPath As String

'This little If statement I originally used for the 2 layered transparent forms. It might prevent further problems if I decide to implement the 2 layered transparent forms, or it might create them if I don't???
If frmSendGetData.Visible = True And frmSendGetData.lblStatus.Caption = "Initializing TCP Settings..." Then
Else
frmMainMenu.Visible = True
End If

    Me.BackColor = RGB(255, 0, 255)
    SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
    SetLayeredWindowAttributes Me.hwnd, RGB(255, 0, 255), 0&, LWA_COLORKEY
    frmMainMenu.Picture = LoadPNG(App.Path & "\GUI\MainMenu.png")
    
    frmLogin.BackColor = RGB(255, 0, 255)
    SetWindowLong frmLogin.hwnd, GWL_EXSTYLE, GetWindowLong(frmLogin.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
    SetLayeredWindowAttributes frmLogin.hwnd, RGB(255, 0, 255), 0&, LWA_COLORKEY
    frmLogin.Picture = LoadPNG(App.Path & "\GUI\MainMenu.png")
    
    frmChars.BackColor = RGB(255, 0, 255)
    SetWindowLong frmChars.hwnd, GWL_EXSTYLE, GetWindowLong(frmChars.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
    SetLayeredWindowAttributes frmChars.hwnd, RGB(255, 0, 255), 0&, LWA_COLORKEY
    frmChars.Picture = LoadPNG(App.Path & "\GUI\MainMenu.png")
    
    If ConnectToServer = True Then
        lblss.Caption = "Online"
        lblss.ForeColor = &H8000&
    Else
        lblss.Caption = "Offline"
        lblss.ForeColor = &H4080&
    End If
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then Call picLogin_Click
    KeyAscii = 0
End Sub

Private Sub picNewAccount_Click()
    frmNewAccount.Visible = True
    Me.Visible = False
End Sub

Private Sub picDeleteAccount_Click()
Dim YesNo As Long

    YesNo = MsgBox("You are on the path for an account deletion, are you sure you want to go through with this?", vbYesNo, GAME_NAME)
    If YesNo = vbYes Then
        frmDeleteAccount.Visible = True
        Me.Visible = False
    End If
End Sub

Private Sub picLogin_Click()
    frmLogin.txtName.Text = Trim$(ReadINI("CONFIG", "Account", App.Path & "\config.ini"))
    frmLogin.txtPassword.Text = Trim$(ReadINI("CONFIG", "Password", App.Path & "\config.ini"))
    If Trim$(frmLogin.txtPassword.Text) <> vbNullString Then
        frmLogin.Check1.Value = Checked
    Else
        frmLogin.Check1.Value = Unchecked
    End If
    frmLogin.Visible = True
    Me.Visible = False
    frmLogin.txtName.SetFocus
    frmLogin.txtName.SelStart = Len(frmLogin.txtName.Text)
End Sub

Private Sub picCredits_Click()
    frmCredits.Visible = True
    Me.Visible = False
End Sub

Private Sub picQuit_Click()
    Call GameDestroy
End Sub

Private Sub Status_Timer()
    If ConnectToServer = True Then
        lblss.Caption = "Online"
        lblss.ForeColor = &H8000&
    Else
        lblss.Caption = "Offline"
        lblss.ForeColor = &H4080&
    End If
End Sub
